<?php

class topshop_middleware_permission
{
    public function handle($request, Closure $next)
    {
        $routeAs = route::currentRouteName();
        pamAccount::setAuthType('sysshop');

        if(!pamAccount::check() && !in_array($routeAs, config::get('permission.common.nologin'))) {
            // 重定向
            return redirect::action('topshop_ctl_passport@signin');
        }
        return $next($request);
    }
}